<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript" src="${basePath}js/My97DatePicker/WdatePicker.js"></script>
<#include "/views/ftl/base/manager_include.ftl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>销售单列表</title>
<style>
A{color: #333;}
</style>
<script type="text/javascript">
$(function(){
	$("#search_button").click(function(){
		$('#select_form').submit();
    });
    $('.byTimeOrderTypeBtn').click(function () {
        $('#byTimeOrderType').val($(this).attr('data-value'));
        $('#select_form').submit();
    });


});
</script>
</head>
<body style="background:#eef3f7;">
<#include "/views/ftl/base/head.ftl">
<div class="Main">
  <div class="dw">
<#include "/views/ftl/base/menu.ftl">
<#function a><#return "销售单列表_List"></#function>
<!--右边内容-->
<div class="Rightbox fl">
    <!--导航-->
    <div class="Bread_crbs clear">
      <div class="Bread_crbs_img fl"></div>
      <div class="Bread_crbs_text fl">
      	<a href="javascript:void(0);"><span>销售单</span></a>
      	<span class="fnt_famy">></span>
      	<a href="javascript:void(0);"><span>销售单列表</span></a>
      </div>
    </div>

      <!--搜索框-->
        <form action="${basePath}manager/PurchaseSaleOrder_saleOrderListPage" id="select_form"  method="POST">


       		 <div class="input_name">

          		<span class=" searchTitle">销单号&nbsp;&nbsp;:</span>
          		<input class="search_text" type="text" name="outOrderNumber" placeholder="请输入关键字 " value="${(requestVo.outOrderNumber)!''}"/>

				 <#-- 订单类型	状态	是否支付	支付方式 -->
                 <#--堂食	结算	是	现金-->
               <#--  orderCategory  orderStatus  isPay payType-->

                 <span class="searchTitle" style="font-size: 14px;color: #333333;width:60px;">订单类型&nbsp;&nbsp;:</span>
                 <select name="orderCategory" style="font-size: 14px;color: #333333;width: 120px;"  >
                     <option value="-100">全部</option>
				 <#list  purchaseSaleOrderCategoryTypeEnum as bean>
                     <option value="${bean.type}"  <#if requestVo.orderCategory ??> <#if requestVo.orderCategory==  bean.type>selected="selected"</#if></#if> >${bean.description}</option>

				 </#list>
                 </select>

                 <span class="searchTitle" style="font-size: 14px;color: #333333;width:60px;">订单状态&nbsp;&nbsp;:</span>
                 <select name="orderStatus" style="font-size: 14px;color: #333333;width: 120px;" >
                     <option value="-100">全部</option>
				 <#list  purchaseSaleOrderStatusTypeEnum as bean>
                     <option value="${bean.type}" <#if  requestVo.orderStatus?? ><#if  requestVo.orderStatus== bean.type >selected="selected" </#if></#if> >${bean.typeName}</option>

				 </#list>

                 </select>


                 <span class="searchTitle" style="font-size: 14px;color: #333333;width:60px;">支付方式&nbsp;&nbsp;:</span>
                 <select name="payType" style="font-size: 14px;color: #333333;width: 120px;"  >
                     <option value="-100">全部</option>
				 <#list  payTypeEnum as bean2>

                     <option value="${bean2.type}"  	 <#if requestVo.payType?? > <#if requestVo.payType== bean2.type >selected="selected"</#if> </#if> >${bean2.typeName}</option>


				 </#list>

                 </select>

                 <span class="searchTitle" style="font-size: 14px;color: #333333;width:60px;">座位&nbsp;&nbsp;:</span>
                 <select name="mealLocationId" style="font-size: 14px;color: #333333;width: 120px;"  >
                     <option value="-100">全部</option>
					 <#if mealLocationList??>


					 <#list  mealLocationList as bean2>

						 <option value="${bean2.id}"   <#if requestVo.mealLocationId?? > <#if requestVo.mealLocationId== bean2.id >selected="selected"</#if> </#if> >${bean2.locationName}</option>

					 </#list>
					 </#if>

                 </select>


            </div>


			 <div class="input_name">



          	<span style="width:60px;">开始时间:</span>
            <input type="name" name="startTime" readonly="readonly"  id="startTime" value="${(requestVo.startTime)!''}"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" type="text">
    		<span style="width:60px;">结束时间:</span>
    		<input name="endTime" readonly="readonly"  value="${(requestVo.endTime)!''}" id="endTime"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" type="text">

			<a href="javascript:void(0);" id="search_button" class="search_btn" style="  display: inline-block;"><span style="color:white;">搜索</span></a>

                 <input type="hidden" id="byTimeOrderType" name="byTimeOrderType" value="0" />
                 <a href="javascript:void(0);" class="yg-btn yg-btn-success byTimeOrderTypeBtn" data-value="1" style="  display: inline-block;"  >当天</a>
                 <a href="javascript:void(0);" class="yg-btn yg-btn-success byTimeOrderTypeBtn" data-value="2" style="  display: inline-block;"> 昨天 </a>
                 <a href="javascript:void(0);" class="yg-btn yg-btn-success byTimeOrderTypeBtn" data-value="3" style="  display: inline-block;"> 7天 </a>
                 <a href="javascript:void(0);" class="yg-btn yg-btn-success byTimeOrderTypeBtn" data-value="4" style="  display: inline-block;"> 30天 </a>

            </div>
            <#-- <a href="javascript:void(0);" id="search_button" class="search_btn fl" align="center" style="  display: inline-block;"><span >搜索</span></a>  -->
        </form>


       <!-- brandId,goodsNumber,goodsName,goodsCategoryId,totalStockCount,applySex,tagPrice,retailPrice,season,unit,-->
        <div class="clear"></div>
        <!--表格列表-->
        <div class="Table"  >
          <table id="table" cellpadding="0" cellspacing="1">
            <tbody>
              <tr id="gl">
              <td style="width: 120px;">销单号</td>
              <td style="width: 150px;">销售时间</td>

                  <td>总价</td>
                  <td>结算价</td>
                  <td>数量</td>

                  <td>折扣</td>
                  <td>优惠</td>

                  <td>用餐地点</td>


                  <td>订单类型</td>
                  <td>状态</td>

                  <td>是否支付</td>
                  <td>支付方式</td>

                  <td>顾客姓名</td>
                  <td>手机号码</td>
                  <td>地址</td>
                  <td>备注</td>

              <td>操作</td>

              </tr>
            <#if (pager.list??)>
           <#if ((pager.list?size)>0)>
           <#list pager.list as product>
     		<tr>

     		    <td>${(product.outOrderNumber)!''}</td>
     		    <td>${(product.clientCreateTime)!''}</td>

                <td>${(product.realTotalPrice)!''}</td>
                <td>${(product.realRetailPrice)!''}</td>
                <td>${(product.totalQuantity)!''}</td>


                <td>${(product.discount)!''}</td>
                <td>${(product.discountPrice)!''}</td>

                <td>${(product.locationName)!''}</td>


                <td>
					<#list  purchaseSaleOrderCategoryTypeEnum as bean>
						<#if product.orderCategory== bean.type >
							<#if product.orderCategory == 1>
                                <span class="yg-text-success">${bean.description}</span>
							<#else >
                                <span class="yg-text-danger">${bean.description}</span>
							</#if>


						</#if>
		   			</#list>
		   		</td>
                <td>
				<#list  purchaseSaleOrderStatusTypeEnum as bean>
					<#if product.orderStatus== bean.type >
						<#if product.orderStatus == 12>
							<span class="yg-text-success">${bean.typeName}</span>
						 <#else >
                             <span class="yg-text-danger">${bean.typeName}</span>
						</#if>

					</#if>
				</#list>

				</td>

                <td>
					 <#if product.isPay==1>
						 <span class="yg-text-success">是</span>
					 <#else >
					 	 <span class="yg-text-danger">否</span>
					 </#if>
				</td>
                <td>
					<#list  payTypeEnum as bean2>
					<#if product.payType== bean2.type >

						${bean2.typeName}
					</#if>
				</#list>
				</td>

				<td>${(product.customerName)!''}</td>
				<td>${(product.customerPhone)!''}</td>
                <td>${(product.customerAddress)!''}</td>
				<td>${(product.customerRemark)!''}</td>


           <td class="tbl_btn">
                <a href="${basePath}manager/PurchaseSaleOrder_saleOrderProductListPage?outOrderNumber=${(product.outOrderNumber)!''}" class="yg-btn yg-btn-primary"><span class="review_single_model"  >查看</span></a>

                </td>
              </tr>
  			</#list>
          </#if>
          </#if>
            </tbody>
          </table>
        </div>
    <!--翻页按钮-->

   <span>数量:</span><span>${(purchaseSaleOrderStatistics.outRealTotalQuantity)?c}件</span>
   <span>总结算:</span> <span>${(purchaseSaleOrderStatistics.realTotalPrice)?c}元</span>
   <span>总生意额：</span>   <span>${(purchaseSaleOrderStatistics.outRealTotalPrice)?c}元</span>


  	<#import "../../base/pager.ftl" as p>
   	<@p.pager pager = pager baseUrl = "manager/PurchaseSaleOrder_saleOrderListPage" parameterMap={"barCode":(requestVo.barCode)!'',"goodsNumber":(requestVo.goodsNumber)!'',"outOrderNumber":(requestVo.outOrderNumber)!'',"shopClerkId":(requestVo.shopClerkId?c)!'',"productSaleStatus":(requestVo.productSaleStatus?c)!'',"startTime":(requestVo.startTime)!'',"endTime":(requestVo.endTime)!'',"firstGoodsCategoryId":(requestVo.firstGoodsCategoryId?c)!'',"secondGoodsCategoryId":(requestVo.secondGoodsCategoryId?c)!''  } />
</div>

<script type="text/javascript">
$(function(){

	loadfirstGoodsCategoryList();
	function loadfirstGoodsCategoryList(){
		$.ajax({
			url : "${basePath}manager/GoodsCategory_goodsCategoryList",
			data : {
				pageNumber:1,
				pageSize:100
			},
			dataType :"JSON",
			cache : false,
			type : "POST",
			success : function(dat){
				if(dat.code==1){
					 var html ='';
					 html+='<option value="">----</option>';
					 $(dat.data).each(function(index,bean){
					 	if('${((requestVo.firstGoodsCategoryId?c)!'')}'==bean.id){
					 		html+='<option value="'+bean.id+'" selected = "selected">'+bean.categoryName+'</option> ';
					 		loadSecondGoodsCategoryList(bean.id);
					 	}else{
					 		html+='<option value="'+bean.id+'">'+bean.categoryName+'</option> ';
					 	}

					 });
					 $('#first_goods_category_list_select').html(html);
				}
			}
		});
	}

	$('#first_goods_category_list_select').change(function(){
	 	var parentId=$('#first_goods_category_list_select').val();
	 	loadSecondGoodsCategoryList(parentId);

	 	var goodsCategoryId =$('#first_goods_category_list_select').find("option:selected").val();
	 	var goodsName=$('#first_goods_category_list_select').find("option:selected").text();
	 	if(goodsCategoryId==''){
	 		$('input[name=goodsName]').val('');
	 	}else{
	 		$('input[name=goodsName]').val(goodsName);
	 	}


	 });

	 function loadSecondGoodsCategoryList(parentGoodsCategoryId){
		if('' == parentGoodsCategoryId){
			var html ='';
			html+='<option value="">----</option>';
			$('#second_goods_category_list_select').html(html);
			return ;
		}

		$.ajax({
			url : "${basePath}manager/GoodsCategory_goodsCategoryList",
			data : {
				goodsCategoryParentId:parentGoodsCategoryId,
				pageNumber:1,
				pageSize:100
			},
			dataType :"JSON",
			cache : false,
			type : "POST",
			success : function(dat){
				if(dat.code==1){
					 var html ='';
					 html+='<option value="">----</option>';
					 $(dat.data).each(function(index,bean){
					 	if('${((requestVo.secondGoodsCategoryId?c)!'')}'==bean.id){
					 		html+='<option value="'+bean.id+'" selected = "selected" >'+bean.categoryName+'</option>';
					 	}else{
					 		html+='<option value="'+bean.id+'">'+bean.categoryName+'</option> ';
					 	}
					 });
					 $('#second_goods_category_list_select').html(html);
				}
			}
		});
	}





});
</script>
</body>
</html>

